﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Masterpages/Main.master" AutoEventWireup="true" 
    CodeFile="ExcelOutput.aspx.cs" Inherits="User_Shares_ExcelOutput" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        
        .DataEnterer
        {
            background-color: #CCCCE7;
            font-weight: bolder;
        }
    </style>
    <script src="~/Scripts/SameHeight.js" type="text/javascript">
    </script>
    <script language="javascript">
        function CallPrint(strid) {
            var prtContent = document.getElementById(strid);
            var WinPrint = window.open('', '', 'letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
            WinPrint.document.write(prtContent.innerHTML);
            WinPrint.document.close();
            WinPrint.focus();
            WinPrint.print();
            WinPrint.close();
//            prtContent.innerHTML = strOldOne;
        }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <asp:Panel ID="Panel1" runat="server" ScrollBars="Auto" Width="100%" ForeColor="Black"
        Direction="RightToLeft" Height="500px"  Font-Names="Tahoma"
        Font-Size="X-Small">
        <asp:GridView ID="GridViewExcelOutput" runat="server" AutoGenerateColumns="False"
            DataKeyNames="ContractId" BackColor="White">
            <Columns>
                <asp:TemplateField HeaderText="مشخصات عمومی روستا">
                    <ItemTemplate>
                        <asp:GridView ID="GridViewVillage" runat="server" AutoGenerateColumns="False" >
                            <Columns>
                                <asp:TemplateField HeaderText="روستا">
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Eval( "Contract.VillageName" ) %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="50px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="کد آبادی">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Eval( "Contract.VillageCode" ) %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="400px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="دهستان">
                                    <ItemTemplate>
                                        <asp:Label ID="Label3" runat="server" Text='<%# Eval( "Contract.Dehestan" ) %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="50px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="بخش">
                                    <ItemTemplate>
                                        <asp:Label ID="Label4" runat="server" Text='<%# Eval( "Contract.Bakhsh" ) %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="50px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="شهرستان">
                                    <ItemTemplate>
                                        <asp:Label ID="Label5" runat="server" Text='<%# Eval( "Contract.City" ) %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="50px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="خانوار">
                                    <ItemTemplate>
                                        <asp:Label ID="Label6" runat="server" Text='<%# Eval( "Contract.Khanevar" ) %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="50px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="جمعیت">
                                    <ItemTemplate>
                                        <asp:Label ID="Label7" runat="server" Text='<%# Eval( "Contract.Population" ) %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="50px" />
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </ItemTemplate>
                    <ItemStyle Width="600px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="مشاور">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval( "Contract.AdvisorFullName" ) %>'></asp:Label>
                    </ItemTemplate>
                    <ItemStyle Width="50px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="مشخصات قرارداد">
                    <ItemTemplate>
                        <asp:GridView ID="GridViewContractInfo"  runat="server"  AutoGenerateColumns="false">
                            <Columns>
                                <asp:TemplateField HeaderText="تاریخ قرارداد">
                                    <ItemTemplate>
                                        <asp:Label ID="LabelContractDate" runat="server" Text='<%# Eval( "Contract.ContractDate" ) %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="50px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="شماره قرارداد">
                                    <ItemTemplate>
                                        <asp:Label ID="LabelContractNumber" runat="server" Text='<%# Eval( "Contract.ContractNumber" ) %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle Width="50px" />
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </ItemTemplate>
                    <ItemStyle Width="100px" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="کنترل روند">
                    <ItemTemplate>
                    <div style="float:right;">
                        <asp:GridView ID="GridViewProjectStatus" runat="server" AutoGenerateColumns="false"
                          HeaderStyle-Height="75px" HeaderStyle-VerticalAlign="Middle"
                            HeaderStyle-BackColor="#CCCCE7">
                            <Columns>
                                <asp:TemplateField HeaderText="وارد کننده اطلاعات" HeaderStyle-CssClass="DataEnterer">
                                    <ItemTemplate>
                                        <table style="width: 150px; min-width: 150px; font-weight: bold;">
                                            <tr>
                                                <td>
                                                    کارفرما
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    مشاور
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    عامل چهار
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    بنیاد شهرستان
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    برنامه زمانبندی
                                                </td>
                                            </tr>
                                        </table>
                                    </ItemTemplate>                                    
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                        </div>
                        <div>
                        <asp:Label ID="LabelFourthFactor" runat="server" Text="" Font-Bold="true"></asp:Label><br />
                        <asp:Label ID="LabelAdvisor" runat="server" Text="" Font-Bold="true"></asp:Label>
                        </div>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <HeaderStyle BackColor="#3366FF" Font-Bold="True" />
            <RowStyle BorderStyle="Solid" BorderWidth="2px" CssClass="OptionalTables" />
        </asp:GridView>
    </asp:Panel>

    <table class="style1">
        <tr>
            <td>
               <%-- <input id="Button1" title="Print" type="button" onclick="CallPrint('divPrint');" value="Print" />--%>
           <%--<asp:Button ID="btnPrint" runat="Server" Font-Names="Tahoma" 
                    onclick="btnPrint_Click" Text="پرینت" Width="56px" />--%>
   </td>
            <td>
                <asp:Button ID="ExportToExcel0" runat="server" Text="ذخیره در فایل Excel" Font-Names="Tahoma"
                    Height="33px" OnClick="ExportToExcel_Click" Width="250px" />
                &nbsp;
            </td>
            <td>
                <asp:Button ID="ExportToWord" runat="server" Text="ذخیره در فایل Word" Font-Names="Tahoma"
                    Height="33px" OnClick="ExportToWord_Click" Width="250px" />
                &nbsp;
            </td>
        </tr>
    </table>
</asp:Content>
